package com.cn.aam.checaiduo.ui.product.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import com.cn.aam.checaiduo.R;
import com.cn.aam.checaiduo.base.adapter.BaseRecycerAdapter;
import com.cn.aam.checaiduo.base.adapter.holder.BaseRecyclerViewHolder;
import com.cn.aam.checaiduo.bean.InfoOfDetailB;
import com.cn.aam.checaiduo.bean.brandsquence.SequenceDataB;
import com.cn.aam.checaiduo.ui.product.vadapter.SequenceLinearAdapter;

import butterknife.BindView;


/**
 * @author 微木森林
 * @time 2017/6/1 下午3:16
 * @description 普通item
 * @remark
 */
public class SequenceTestAdapter extends BaseRecycerAdapter<SequenceDataB> {


    public SequenceTestAdapter(Context mContext) {
        super(mContext);
    }

    //item
    @Override
    protected BaseRecyclerViewHolder getViewHolder(View picNewsView) {
        return new MyViewholder(picNewsView);
    }

    @Override
    protected int getItemLayoutRes() {
        return R.layout.list_vitem_normal_info;
    }


    @Override
    protected void ItemVIewChange(BaseRecyclerViewHolder recyclerholder, final int position) {
        MyViewholder holder = (MyViewholder) recyclerholder;
        SequenceDataB item = getItem(position);
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onItemClick != null) onItemClick.onClick(position);
            }
        });
        holder.tvKey.setText("第" + item.getStart_sequence() + "~" + item.getEnd_sequence() + "期");
        if (item.getNumber() - item.getSale_number() == 0) {
            holder.tvValue.setText("全部回款");
        } else {
            holder.tvValue.setText("剩余" + (item.getNumber() - item.getSale_number()) + "辆");
        }
    }


    public class MyViewholder extends BaseRecyclerViewHolder {
        @BindView(R.id.tv_key)
        TextView tvKey;
        @BindView(R.id.tv_value)
        TextView tvValue;

        public MyViewholder(View view) {
            super(view);
        }
    }


}